from model.util import *
class ship():
    def __init__(self, index, x, y, speed, cls):
        self.index = index
        self.x = x
        self.y = y
        self.speed = speed
        self.cls = cls
        self.res = 0
        self.status = 'unchecked'
        self.ssin = y / math.sqrt(math.pow(x, 2)+math.pow(y, 2))
        self.ccos = x / math.sqrt(math.pow(x, 2)+math.pow(y, 2))

    def rest_time(self):
        self.cross_point = cal_cross_point(self.x, self.y)
        self.res = math.sqrt(math.pow(self.x-self.cross_point[0], 2) + math.pow(self.y-self.cross_point[1], 2))/self.speed
        return self.res
